#include "windows.h"
#include "WinMutex.h"


cWinMutex::cWinMutex()
{
	m_mutex = CreateMutex(NULL, FALSE, NULL);
}

cWinMutex::~cWinMutex()
{
	CloseHandle(m_mutex);
}

void cWinMutex::lock()
{
	WaitForSingleObject(m_mutex, INFINITE);
}

void cWinMutex::lock(long millisec)
{
	WaitForSingleObject(m_mutex, millisec);
}

void cWinMutex::unlock()
{
	ReleaseMutex(m_mutex);
}
